//通过重命名操作实现文件移动
const fs = require("fs");
const oldPath = "fileNeedToMove.txt";
const newPath = "moveTo/newFile.txt";

fs.rename(oldPath, newPath, (err, data) => {
    if(err){
        console.log(`Sorry, move file ${oldPath} failure`);
    }else{
        console.log(`Move file ${oldPath} success, new location is ${newPath}`);
    }
})
